<?php
// No direct access to this file
defined('_JEXEC') or die;
 
/**
 * Forum component helper.
 */
abstract class ForumHelper
{
	/**
	 * Configure the Linkbar.
	 */
	public static function addSubmenu($vName) 
	{
	
		
		JSubMenuHelper::addEntry(
			JText::_('COM_FORUM_SUBMENU_TOPICS'),
			'index.php?option=com_forum&view=topics',
			$vName == 'topics'
		);

		JSubMenuHelper::addEntry(
			JText::_('COM_FORUM_SUBMENU_CATEGORIES'),
			'index.php?option=com_categories&extension=com_forum',
			$vName == 'categories'
		);
		if ($vName=='categories') {
			JToolBarHelper::title(
				JText::sprintf('COM_CATEGORIES_CATEGORIES_TITLE', JText::_('com_forum')),
				'topic-categories');
		}

		JSubMenuHelper::addEntry(
			JText::_('COM_FORUM_SUBMENU_POSTS'),
			'index.php?option=com_forum&view=posts',
			$vName == 'posts'
		);

	}
	/**
	 * Get the actions
	 */
	
	public static function getActions($categoryId = 0)
	{
		$user	= JFactory::getUser();
		$result	= new JObject;

		if (empty($categoryId)) {
			$assetName = 'com_forum';
		} else {
			$assetName = 'com_forum.category.'.(int) $categoryId;
		}

		$actions = array(
			'core.admin', 'core.manage', 'core.create', 'core.edit', 'core.edit.state', 'core.delete'
		);

		foreach ($actions as $action) {
			$result->set($action,	$user->authorise($action, $assetName));
		}

		return $result;
	}
	
}
